package com.mezz.bones.im.gateway;

import com.mezz.bones.im.gateway.boot.WebsocketServerBoot;
import com.mezz.bones.im.gateway.config.NettyProperties;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

import javax.annotation.Resource;


/**
 * @Author: zhuang
 * @Date: 2024/7/12 17:13
 * @Description: TODO
 * @Version: 1.0
 **/
@ComponentScan("com.mezz.bones")
@SpringBootApplication
public class ImApplication implements CommandLineRunner {

    @Resource
    private NettyProperties nettyProperties;

    @Resource
    private WebsocketServerBoot websocketServerBoot;
    public static void main(String[] args) {
        SpringApplication.run(ImApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        websocketServerBoot.start(nettyProperties.getProtocolsMap().get("websocket"));
    }
}
